import time
from functools import wraps
from flask import current_app

def measure_performance(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        start_time = time.time()
        result = func(*args, **kwargs)
        end_time = time.time()
        
        duration = end_time - start_time
        current_app.logger.info(
            f"Performance: {func.__name__} took {duration:.2f} seconds"
        )
        
        return result
    return wrapper 